package hbt;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil
{
    private static final SessionFactory sessionFactory;
    static
    {
        try
        {
        	 AnnotationConfiguration config = new AnnotationConfiguration();
        	 config.addAnnotatedClass(dominioEntity.Cliente.class);        	
        	 config.addAnnotatedClass(dominioEntity.Proveedor.class);
        	 config.addAnnotatedClass(dominioEntity.Rodamiento.class);
        	 config.addAnnotatedClass(dominioEntity.Stock.class);
        	 config.addAnnotatedClass(dominioEntity.MovimientoStock.class);
        	 config.addAnnotatedClass(dominioEntity.ListaPrecios.class);
        	 config.addAnnotatedClass(dominioEntity.ItemListaPrecios.class);
        	 config.addAnnotatedClass(dominioEntity.Cotizacion.class);
        	 config.addAnnotatedClass(dominioEntity.SolicitudRodamientos.class);
        	 config.addAnnotatedClass(dominioEntity.ItemCotizacion.class);
        	 config.addAnnotatedClass(dominioEntity.ItemSolicitud.class);
        	 
        	 sessionFactory = config.buildSessionFactory();
        
        }
        catch (Throwable ex)
        {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
  
    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }
}
